<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        table,tr,td,th {
            border: 2px solid;
            border-collapse: collapse;
        }
    </style>
</head>

<body>
    <div id="top">
        <input type="text" placeholder="查找博客标题、摘要、内容、分类、作者" name="keyword"><input type="button" value="查找"
            onclick="query()">
        <input type="button" value="添加" onclick="add()">
    </div>
    <div>
        <table id="tb">
            <tr>
                <th>id</th>
                <th>标题</th>
                <th>摘要</th>
                <th>内容</th>
                <th>分类</th>
                <th>作者</th>
                <th>发表时间</th>
                <th>操作</th>
            </tr>

        </table>
    </div>

    <script src="./js/jquery-3.6.0.min.js"></script>
    <script src="./config/url.js"></script>
    <script src="./js/api.js"></script>
    <script src="./js/init.js"></script>
    <script>
        function query() {
            let keyword = $('[name=keyword]').val();

            getProductByKeyword(keyword);
        }
        function add() {
            window.location.href = `./addOrEdit.html`
        }
        function edit(id) {
            window.location.href = `./addOrEdit.html?id=${id}`
        }
        function del(id) {
            
            if(confirm('确定删除吗')){
                deleteData(id).then((res) => {
                    replay(res);
                })
            }
            
        }
    </script>
</body>

</html>